home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / mail / delivery / deliver.tz / deliver / misc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-07  |  2.5 KB  |  147 lines

  1. /* $Header: misc.h,v 2.4 89/12/19 16:28:05 network Exp $
  2.  *
  3.  * Miscellaneous definitions.
  4.  *
  5.  * $Log:    misc.h,v $
  6.  * Revision 2.4  89/12/19  16:28:05  network
  7.  * Simplify preprocessor conditionals for pre-ANSI compilers.
  8.  * 
  9.  * Revision 2.3  89/12/14  17:43:10  network
  10.  * Rework setvbuf() configuration to avoid errors.
  11.  * 
  12.  * Revision 2.2  89/10/02  10:36:43  network
  13.  * Declare exit() as void.
  14.  * 
  15.  * Revision 2.1  89/06/09  12:25:35  network
  16.  * Update RCS revisions.
  17.  * 
  18.  * Revision 1.7  89/06/09  12:23:56  network
  19.  * Baseline for 2.0 release.
  20.  * 
  21.  */
  22.  
  23. /*
  24.  * Non-portable include files
  25.  */
  26.  
  27. #ifdef USG
  28. #include <fcntl.h>
  29. #include <string.h>
  30. #include <memory.h>
  31. #endif
  32.  
  33. #ifdef BSD
  34. #include <strings.h>
  35. #include <sys/file.h>
  36. #endif
  37.  
  38. /*
  39.  * Constants
  40.  */
  41.  
  42. #ifdef NULL
  43. #undef NULL
  44. #endif
  45. #define NULL    0               /* The One True NULL */
  46.  
  47. #define FALSE   0
  48. #define TRUE    1
  49.  
  50. #ifndef O_RDONLY
  51. #define O_RDONLY   0
  52. #define O_WRONLY   1
  53. #define O_RDWR     2
  54. #endif
  55.  
  56. /*
  57.  * Macros.
  58.  */
  59.  
  60. /* Length parameter for fgets() on given buffer. */
  61.  
  62. #define GETSIZE(buf)    (int) (sizeof(buf) - 1)
  63.  
  64. /*
  65.  * Public data.
  66.  */
  67.  
  68. extern  char    **environ;
  69.  
  70. /*
  71.  * Common library functions.
  72.  */
  73.  
  74. extern  char    *ctime();
  75. extern  char    *getenv();
  76. extern  char    *malloc();
  77. extern  char    *realloc();
  78. extern  char    *mktemp();
  79. extern  int     putenv();
  80. extern  long    lseek();
  81. extern  long    time();
  82. extern  void    free();
  83. extern  void    exit();
  84.  
  85. #ifdef DECLARE_SIGNAL
  86. extern  SIGTYPE (*signal())();
  87. #endif
  88.  
  89. /*
  90.  * String search functions.
  91.  */
  92.  
  93. #ifndef USG
  94.  
  95. #ifndef BSD
  96. extern  char    *index();
  97. extern  char    *rindex();
  98. #endif /* not BSD */
  99.  
  100. #define strchr          index
  101. #define strrchr         rindex
  102.  
  103. #endif
  104.  
  105. /*
  106.  * Memory copy and zero.
  107.  */
  108.  
  109. #ifdef USG
  110. #define Copy(d,s,n)     (void) memcpy(d,s,n)
  111. #define Zero(d,n)       (void) memset(d,0,(int)(n))
  112. #else /* not USG */
  113. #ifdef BSD
  114. #define Copy(d,s,n)     bcopy(s,d,n)
  115. #define Zero(d,n)       bzero(d,n)
  116. #else /* not BSD */
  117. #define MEMFUNCS        /* define Copy() and Zero() in sysdep.c */
  118. #endif /* not BSD */
  119. #endif /* not USG */
  120.  
  121. /*
  122.  * Line-buffering on stdio files.
  123.  */
  124.  
  125. #ifdef USG
  126.  
  127. #ifdef SETVBUF_BUF_TYPE
  128. #define Linebuf(f)      (void) setvbuf(f, (char *)NULL, _IOLBF, BUFSIZ)
  129. #endif
  130. #ifdef SETVBUF_TYPE_BUF
  131. #define Linebuf(f)      (void) setvbuf(f, _IOLBF, (char *)NULL, BUFSIZ)
  132. #endif
  133.  
  134. #else /* not USG */
  135. #ifdef BSD
  136.  
  137. #define Linebuf(f)      (void) setlinebuf(f)
  138.  
  139. #endif /* BSD */
  140. #endif /* not USG */
  141.  
  142. /* If line buffering isn't possible, don't buffer at all. */
  143.  
  144. #ifndef Linebuf
  145. #define Linebuf(f)      (void) setbuf(f, (char *)NULL)
  146. #endif
  147.